<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
/**
 * @package
 * @file                 $RCSfile: global.init.inc,v $
 * @version              $Revision: 1.0 $
 * @modifiedby           $Author: handaoliang $
 * @lastmodified         $Date: 2010/10/15 16:40:05 $
 * @copyright            Copyright (c) 2010, TinyTui2
**/
/**
 * 全局初始化文件
**/
if(!defined("BASE_LIB_DIR")){
    define("BASE_LIB_DIR",dirname(dirname(__FILE__))."/libs");
}

require_once(BASE_LIB_DIR.'/view_func.php');
require_once(BASE_LIB_DIR.'/twitter_func.php');
require_once(BASE_LIB_DIR.'/proxy_func.php');
require_once(BASE_LIB_DIR.'/tweet_rating.php');
require_once(BASE_LIB_DIR.'/global_func.php');
require_once(BASE_LIB_DIR.'/smarty/smartyTemplate.class.php');

//formate smarty object.
$smarty = &new smartyTemplate(BASE_TEMPLATES_DIR,SMARTY_TEMPLATES_C,SMARTY_CACHE_DIR);
//init smarty variables.
$smarty->assign("charset",SYSTEM_CHARSET);
$smarty->assign("lang",SYSTEM_LANG);
$smarty->assign("res",RES_PATH);
$smarty->assign("www",WWW_PATH);


if(isset($_COOKIE['password']) && isset($_COOKIE['username'])){
	define("USER",$_COOKIE['username']);
	define("PASS",$_COOKIE['password']);
} else {
    $user_os = getUserOS();
    if($user_os == "Unknown"){
        $smarty->display("mobile/login.tpl");
    }else{
        $smarty->display("pc/login.tpl");
    }
	exit;
}
define("USERAGENT","tinytui");
define("USER_PASS",USER.":".PASS);
define("ENCRYPT_CODE","");

//timezone for Asia/Shanghai
date_default_timezone_set ('Asia/Shanghai');

//设置系统语言。
$translations = load_translations('zh_cn');
?>
